$(function () {
    //判断浏览器支不支持
    if (('sessionStorage' in window) && ('onpageshow' in window)) {
        var suffix = '_has_show';

        window.addEventListener('pageshow', function () {
            var temp = window.sessionStorage.getItem(location.href);
            if (temp != null && temp != undefined && temp != '') {
                window.sessionStorage.removeItem(location.href);
                //防止无限刷新页面，因为reload先触发onpagehide，然后再触发onpageshow
                window.sessionStorage.setItem(location.href + suffix, location.href);
                window.location.reload();
            }
        });

        window.addEventListener('pagehide', function () {
            var temp = window.sessionStorage.getItem(location.href + suffix);
            if (temp == null || temp == undefined || temp == '') {
                window.sessionStorage.setItem(location.href, location.href);
            } else {
                window.sessionStorage.removeItem(location.href + suffix);
            }
        });
    }

});
